<template>
    <div class="error-page">
        <AppError :data="pageMessage" @logout="logout" @btn-click="btnClick"></AppError>
    </div>
    
</template>

<script setup>
import { AppError } from '@yanxiu/app-error';
import { useStore } from 'vuex';
import { pageJump } from '@/global/location-transfer';
import { computed } from '@vue/runtime-core';


const store = useStore();

const pageMessage = computed(() => {
    console.log(store.state.pageMessage, '=======store.state.pageMessage===========');
    return store.state.pageMessage || {};
})

function logout() {
    store.dispatch('logout');
}

function btnClick(target=null) { // 默认走首页
    if (pageMessage.value.target) {
        store.dispatch('jsBridge/disposeBridge', {
            method: 'goNewPage',
            url: pageMessage.value.target,
            isReplace: true,
            naviBarHidden: false
        })
    } else {
        // 重新加载
    }
}

</script>

<style lang="scss" scoped>
// .error-page {
//     height: 100vh;
// }
</style>
